1 module unde.games.dizzy.omega.animations.stalagmite; 2 3 import derelict.opengl3.gl; 4 import unde.games.object; 5 import unde.games.renderer; 6 import unde.global_state; 7 8 class Stalagmite:StaticGameObject 9 { 10 StaticGameObject the_hero; 11 12 this(MainGameObject root, StaticGameObject hero) 13 { 14 frame = -1; 15 the_hero = hero; 16 17 models["stalagmite"] = root.models["stalagmite"]; 18 super(root); 19 } 20 21 override void draw(GlobalState gs) 22 { 23 float f = 0.0; 24 if (frame >= 0.0) 25 { 26 f = root.frame - frame; 27 } 28 29 glPushMatrix(); 30 if (f <= 0.0) 31 { 32 } 33 else if (f < 50.0) 34 { 35 glTranslatef(237.2, -6.0 + (6.0-4.0)*f/50.0, 0.0); 36 recursive_render(gs, models["stalagmite"]); 37 } 38 else 39 { 40 glTranslatef(237.2, -4.0, 0.0); 41 recursive_render(gs, models["stalagmite"]); 42 } 43 44 glPopMatrix(); 45 46 } 47 48 override bool tick(GlobalState gs) 49 { 50 if (frame < 0 && the_hero.x > 235.8 && -6.0 < the_hero.y && the_hero.y < -1.9) 51 { 52 frame = root.frame; 53 } 54 55 return true; 56 } 57 } 58